package com.collapse.union.gitee.auto.flow.demo;

import com.collapse.union.gitee.auto.flow.demo.config.DataSourceInitializer;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;


@SpringBootApplication
public class DemoApplication implements ApplicationRunner, DisposableBean {

    @Autowired
    private DataSourceInitializer dataSourceInitializer;

    public static void main(String[] args) {
        new SpringApplicationBuilder(DemoApplication.class)
                .run(args);
    }

    @Override
    public void destroy() throws Exception {

    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        dataSourceInitializer.startDbInitializer();
    }
}
